Skip to content

Normalize language in cwd#243

Merged
mishushakov merged 3 commits intomainfrom
cwd-normalize-lang
Mar 31, 2026
Merged

Normalize language in cwd#243
mishushakov merged 3 commits intomainfrom
cwd-normalize-lang

Conversation

@mishushakov
Copy link
Copy Markdown
Member

before

import { Sandbox } from '@e2b/code-interpreter'

const sbx = await Sandbox.create()

const cwdJS = await sbx.runCode('process.cwd()', { language: 'js' })

const cwdPY = await sbx.runCode(`from pathlib import Path
cwd = Path.cwd()
cwd`, { language: 'python' })

console.log(cwdJS.text)
console.log(cwdPY.text)

output

/
/home/user

after

output

/home/user
/home/user

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 31, 2026

PR Summary

Low Risk
Low risk: small conditional change affecting only cwd initialization for JavaScript/TypeScript executions, with minimal blast radius and no security-sensitive logic.

Overview
Normalizes cwd setting for JS runtimes. change_current_directory now applies process.chdir(...) when language is javascript or typescript (instead of the legacy js value), aligning behavior across languages.

Adds a patch changeset for @e2b/code-interpreter-template documenting the normalization.

Written by Cursor Bugbot for commit 4904119. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward normalization that aligns change_current_directory with the existing language alias handling in _set_env_var_snippet.

Extended reasoning...

Overview

This PR modifies a single conditional in change_current_directory (messaging.py) to accept "javascript" and "typescript" as valid language aliases alongside the already-handled "js", and adds a changeset entry for the patch release.

Security Risks

None. The path argument is already passed unsanitized in sibling branches; this change does not alter that behavior or introduce new surface area.

Level of Scrutiny

Low. This is a one-line logic fix with no design decisions. The pattern being matched — treating "javascript" and "typescript" as equivalent aliases — is already established in _set_env_var_snippet and _delete_env_var_snippet, so this is simply bringing change_current_directory into alignment.

Other Factors

The pre-existing bug (missing del self._executions[message_id] cleanup in change_current_directory) is flagged as an inline comment but predates this PR and is out of scope here. The PR itself is correct and complete for its stated purpose.

@mishushakov mishushakov merged commit 6a3e536 into main Mar 31, 2026
14 checks passed
@mishushakov mishushakov deleted the cwd-normalize-lang branch March 31, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants